package com.neusoft.EYSystem.controller;

import com.neusoft.EYSystem.redisDao.RedisDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;

@RestController
@RequestMapping("/redis")
public class RedisController {

    @Autowired
    private RedisDAO redisDAO;

    // 这里可以添加一些操作Redis的方法
    // 例如：设置值、获取值等
     @RequestMapping("/set")
     public String setValue(String key, String value, long expireTime) {
         redisDAO.set(key, value, expireTime, TimeUnit.SECONDS);
         return "Value set successfully";
     }

     @RequestMapping("/get")
     public String getValue(String key) {
         return redisDAO.get(key);
     }

}
